Log In  
[back to top]

[ :: Read More :: ]

Cart #42526 | 2017-07-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
14

I got a lot of comments about my smooth camera transitions in a recent WIP that I posted. I thought I'd just go ahead and share how I did it with a code sample cart. I'm posting the important function below, but feel free to look at the cart's code to see how it's implemented. I'm not a wizard, and I know it could probably be simplified somehow, so feel free to use and improve as you see fit. If you do improve it, let me know here so I can update the code for others to see!

function smooth_cam(spd)
 cam_x+=(flr(p.x/128)*128-cam_x)*spd
 cam_y+=(flr(p.y/128)*128-cam_y)*spd
 if (abs(cam_x-flr(p.x/128)*128)<0.5) cam_x=flr(p.x/128)*128
 if (abs(cam_y-flr(p.y/128)*128)<0.5) cam_y=flr(p.y/128)*128
 camera(cam_x,cam_y)
end

UPDATE: I fixed a minor bug. (I had smooth_cam(speed) running after map(0,0), when it should be running before. I also added the Z/X buttons to allow you to change the speed of the transition for this demo so you can see what different speeds look like.

P#42455 2017-07-13 22:22 ( Edited 2017-09-22 22:08)

[ :: Read More :: ]

Cart #42293 | 2017-07-09 | Code ▽ | Embed ▽ | No License
21


This was fun to make. I added a bunch of juicy stuff I usually do in Unity just for fun. The code is heavily commented and more verbose than it necessarily needs to be, because I wanted to make it easy to pull apart for people less familiar with making stuff in PICO-8. I'll keep adding stuff over time, but figured I'd release it as it is so far.

My highest score so far is 232. What's yours?

UPDATE: Added a possibility of slimes dropping a heart if you blow them up.

P#42286 2017-07-08 22:43 ( Edited 2017-07-09 06:01)

[ :: Read More :: ]

Cart #42222 | 2017-07-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
25


NOTE: There's nothing to "play" in this cart! It's all in the cart's code!

I remember reading a thread a while back about the idea of having the manual for PICO-8 available in the console itself, maybe in cart form. I plan on getting a PocketC.H.I.P. and I really want to have the whole API reference available to me right from inside PICO-8. So I decided to just put it all in a cart to always have a reference with me.

I made a lot of use of Neko250's awesome API cheatsheet, which is why he's credited as well as zep. I'm sure there are probably typos to correct and maybe an error here and there, so let me know if you see anything needing fixing. I'll try to keep it up to date. In the meantime, feel free to use it yourself.

P#42223 2017-07-06 01:11 ( Edited 2017-07-10 19:16)

[ :: Read More :: ]

Cart #42192 | 2017-07-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7


Just a fun thing I made this afternoon. Happy 4th!

(And to everyone outside the US, I hope you had a great day too.) :D

P#42193 2017-07-05 00:11 ( Edited 2017-07-05 04:11)

[ :: Read More :: ]

These are variations of the rnd() function, but these return integers. You can either give just a maximum value or an arbitrary minimum and maximum value. You can also choose whether you want the maximum value to be exclusive or inclusive.

--random int between 0,h
function rand(h) --exclusive
    return flr(rnd(h))
end
function randi(h) --inclusive
    return flr(rnd(h+1))
end

--random int between l,h
function randb(l,h) --exclusive
    return flr(rnd(h-l))+l
end
function randbi(l,h) --inclusive
    return flr(rnd(h+1-l))+l
end
P#41116 2017-05-29 17:48 ( Edited 2017-05-29 21:48)

[ :: Read More :: ]

Cart #41102 | 2017-05-29 | Code ▽ | Embed ▽ | No License
4

This is a simple cave game I'm making as part of some curriculum to teach kids how to make games in PICO-8. This would not be their first introduction to PICO-8. This would be after they have learned some other basic concepts. Feedback is welcome. :)

What's your high score?

P#41097 2017-05-28 23:36 ( Edited 2017-05-30 00:27)